package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：工单信息表【工单状态】枚举类
 * @Author： aman
 * @Date： 2025/2/8 10:36
 */
@Getter
@AllArgsConstructor
public enum TicketStatusEnum {
    // 【TS_INSERT】为默认值
    TS_INSERT(1, "新建"),
    TS_PROCESSING(2, "处理中"),
    TS_DONE(3, "已完成"),
    ;

    @EnumValue
    private final Integer code;
    private final String name;

    public static TicketStatusEnum getByCode(Integer code) {
        for (TicketStatusEnum ticketStatusEnum : TicketStatusEnum.values()) {
            if (ticketStatusEnum.getCode() == code) {
                return ticketStatusEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
